package com.example.trackcircuitdiagnosis.config;

import com.example.trackcircuitdiagnosis.service.IMysqlBackService;
 import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer;

/**
 * @author long chen
 * @date 2024-04-10 16:41
 */
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class StaticScheduleTask  {

    @Resource
    private IMysqlBackService mysqlBackService;
//    /**
//     * 每天六点备份数据库
//     */

//    @Scheduled(cron = "0 0/5 * * * ?")
    @Scheduled(cron = "00 00 6 * * ?")
    public void databaseBack(){
//        if (port.equals(9003)) {
//            System.out.println("");
        mysqlBackService.databaseBack();
//        }
    }
}
